/*
 * HalThread.cpp
 *
 *  Created on: 28-10-2011
 *      Author: cristian
 */

#include "HalThread.h"

HalThread::HalThread() :
		HalSocket(false, false) {

	this->thread = new pthread_t;
	this->attr = new pthread_attr_t;
	this->setRun(1);
	pthread_attr_init(attr);
	this->mutex = PTHREAD_MUTEX_INITIALIZER;
	pthread_attr_setdetachstate(attr, PTHREAD_CREATE_DETACHED);



}

pthread_attr_t *HalThread::getAttr() const {
	return attr;
}

pthread_t *HalThread::getThread() const {
	return thread;
}

void HalThread::setAttr(pthread_attr_t *attr) {
	this->attr = attr;
}

void HalThread::setThread(pthread_t *thread) {
	this->thread = thread;
}

bool HalThread::isRun() const {
	return run;
}

void HalThread::setRun(bool run) {
	this->run = run;
}

HalThread::~HalThread() {
	delete this->thread;
	delete this->attr;
}

